import java.util.ArrayList;
import java.util.List;

public class num78 {
    public List<List<Integer>> subsets(int[] nums) {
        List<List<Integer>> res = new ArrayList<>();
        List<Integer> path = new ArrayList<>();
        dfs(nums,path,res,0);
        return  res;
    }

    private void dfs(int[] nums, List<Integer> path, List<List<Integer>> res,int depth) {
        if(!res.contains(path)) {
            res.add(new ArrayList<>(path));
        }
        for (int i = depth; i < nums.length; i++) {
            if(!path.contains(nums[i])) {
                path.add(nums[i]);
            }
            dfs(nums,path,res,i + 1);
            path.remove(path.size() - 1);
        }
    }
}
